﻿using RuoVea.ExSugar.Attributes;
using RuoVea.ExSugar.Entity;
using SqlSugar;
using System.ComponentModel;

namespace RuoVea.OmiApi.Article.Entitys;

/// <summary>
/// 文章点赞表
/// </summary>
[SugarTable(nameof(ArtLike), TableDescription = "文章点赞表")]
[Description("文章点赞表")] 
[SugarIndex($"IX_{nameof(ArtLike)}_{nameof(ArticleId)}_{nameof(UserId)}", nameof(ArticleId), OrderByType.Asc, nameof(UserId), OrderByType.Asc, true)]
[SugarIndex($"IX_{nameof(ArtLike)}_{nameof(UserId)}", nameof(UserId), OrderByType.Asc)]
[SugarIndex($"IX_{nameof(ArtLike)}_{nameof(CreateTime)}", nameof(CreateTime), OrderByType.Desc)]
public class ArtLike : EntityBase
{ 
    /// <summary>
    /// 文章ID
    /// </summary>
    [ConfigSugarColumn(columnKey:  nameof(ArticleId), columnDescription :"文章ID")]
    public long ArticleId { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    [ConfigSugarColumn(columnKey:  nameof(UserId), columnDescription :"用户ID")]
    public long UserId { get; set; }

    /// <summary>
    /// 导航属性 - 文章（多对一）
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ArticleId))]
    [SugarColumn(IsIgnore = true)]
    public ArtArticle Article { get; set; }
}
